#include "ImguiDemoTest.h"
#include "Imgui/imgui.h"
#include "glad/glad.h"
namespace Test
{
	ImguiDemoTest::ImguiDemoTest() :clear_color{0.2f,0.3f,0.1f,1.0f}
	{
	}
	void ImguiDemoTest::Enter()
	{
	}

	void ImguiDemoTest::Leave()
	{
	}

	void ImguiDemoTest::OnRender()
	{
		glClearColor(clear_color[0], clear_color[1], clear_color[2], clear_color[3]);
		glClear(GL_COLOR_BUFFER_BIT);//This is Clear
	}

	void ImguiDemoTest::OnImguiRender()
	{
		#pragma region ImguiTestCode
		if (show_demo_window)
			ImGui::ShowDemoWindow(&show_demo_window);

		{
			static float f = 0.0f;
			static int counter = 0;
			ImGui::Begin("Hello, world!", 0);                          // Create a window called "Hello, world!" and append into it.
			ImGui::Text("This is some useful text.");               // Display some text (you can use a format strings too)
			ImGui::Checkbox("Demo Window", &show_demo_window);      // Edit bools storing our window open/close state
			ImGui::Checkbox("Another Window", &show_another_window);
			ImGui::ColorEdit3("clear color", clear_color); // Edit 3 floats representing a color
			if (ImGui::Button("Button"))                            // Buttons return true when clicked (most widgets return true when edited/activated)
				counter++;
			ImGui::SameLine();
			ImGui::Text("counter = %d", counter);
			ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
			ImGui::End();
		}
		if (show_another_window)
		{
			ImGui::Begin("Another Window", &show_another_window);   // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
			ImGui::Text("Hello from another window!");
			if (ImGui::Button("Close Me"))
				show_another_window = false;
			ImGui::End();
		}
#pragma endregion
	}
}

